import type { AxiosResponse } from 'axios'
import request from '@/utils/request'

const serviceName = import.meta.env.VITE_APP_SREVICE_NAME_CITY_MANAGEMENT

class VidServe {
  /** 收藏列表 */
  favlist<T = any>(params = {}): Promise<AxiosResponse<T>> {
    return request({
      url: `${serviceName}/mobile/video/focusList`,
      method: 'get',
      params
    })
  }

  /** 取消收藏 */
  cancelFav<T = any>(data = []): Promise<AxiosResponse<T>> {
    return request({
      url: `${serviceName}/mobile/video`,
      method: 'delete',
      data
    })
  }

  /** 视频列表 */
  list<T = any>(params: {
    type?: string
    pageNum: number
    pageSize: number
    content?: string
  }): Promise<AxiosResponse<T>> {
    return request({
      url: `${serviceName}/mobile/video/videoList`,
      method: 'get',
      params
    })
  }

  /** 添加收藏 */
  addFav<T = any>(data = []): Promise<AxiosResponse<T>> {
    return request({
      url: `${serviceName}/mobile/video/addFocus`,
      method: 'post',
      data
    })
  }
}

export default new VidServe()
